package com.huopaolan.yohuoshop.Adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.huopaolan.yohuoshop.Bean.BrandListEntity;
import com.huopaolan.yohuoshop.R;

import java.util.List;

public class BrandListAdapter extends BaseMultiItemQuickAdapter<BrandListEntity, BaseViewHolder> {

    public BrandListAdapter(@Nullable List<BrandListEntity> data) {
        super(data);
        addItemType(1, R.layout.item_brand_letter);
        addItemType(2, R.layout.item_shop_name);
    }

    @Override
    protected void convert(BaseViewHolder helper, BrandListEntity item) {
        if (helper.getItemViewType() == 1) {
            helper.setText(R.id.brand_letter, item.brand_letter);
        } else if (helper.getItemViewType() == 2) {
            helper.setText(R.id.brand_shop, item.brand_name);
            if (item.hot_tag.equals("true")) {
                ImageView helperView = helper.getView(R.id.brand_image);
                helperView.setImageResource(R.drawable.js_community_images_home_nav_hot);
            }
        }
    }
}
